const UserLayout = () => import("@/layout/UserLayout.vue");

/**
 * 用户端路由配置
 * 使用独立的用户端布局，不依赖管理端的布局系统
 * 这些路由不会显示在管理端的菜单中
 */
export default [
  // 不需要布局的独立页面（登录、注册等）
  {
    path: "/user/login",
    name: "UserLogin",
    component: () => import("@/views/user/login/index.vue"),
    meta: {
      title: "用户登录",
      showLink: false
    }
  },
  {
    path: "/user/register",
    name: "UserRegister",
    component: () => import("@/views/user/register/index.vue"),
    meta: {
      title: "用户注册",
      showLink: false
    }
  },
  {
    path: "/user/forgot-password",
    name: "UserForgotPassword",
    component: () => import("@/views/user/forgot-password/index.vue"),
    meta: {
      title: "忘记密码",
      showLink: false
    }
  },
  {
    path: "/user/reset-password",
    name: "UserResetPassword",
    component: () => import("@/views/user/reset-password/index.vue"),
    meta: {
      title: "重置密码",
      showLink: false
    }
  },
  // 需要布局的用户端页面
  {
    path: "/user",
    component: UserLayout,
    redirect: "/user/home",
    meta: {
      title: "用户端",
      showLink: false,
      rank: 1000
    },
    children: [
      {
        path: "/user/home",
        name: "UserHome",
        component: () => import("@/views/user/home/index.vue"),
        meta: {
          title: "用户首页",
          showLink: false
        }
      },
      {
        path: "/user/profile/:id?",
        name: "UserProfile",
        component: () => import("@/views/user/profile/index.vue"),
        meta: {
          title: "个人主页",
          showLink: false
        }
      },
      {
        path: "/user/profile-edit",
        name: "UserProfileEdit",
        component: () => import("@/views/user/profile-edit/index.vue"),
        meta: {
          title: "个人信息设置",
          showLink: false
        }
      },
      {
        path: "/user/article/:id",
        name: "UserArticleDetail",
        component: () => import("@/views/user/article/detail.vue"),
        meta: {
          title: "文章详情",
          showLink: false
        }
      },
      {
        path: "/user/article/publish",
        name: "UserArticlePublish",
        component: () => import("@/views/user/article/publish/index.vue"),
        meta: {
          title: "发布文章",
          showLink: false,
          requiresAuth: true
        }
      },
      {
        path: "/user/article/edit/:id",
        name: "UserArticleEdit",
        component: () => import("@/views/user/article/edit/index.vue"),
        meta: {
          title: "编辑文章",
          showLink: false,
          requiresAuth: true
        }
      },
      {
        path: "/user/article/my",
        name: "UserArticleMy",
        component: () => import("@/views/user/article/my/index.vue"),
        meta: {
          title: "我的文章",
          showLink: false,
          requiresAuth: true
        }
      },
      {
        path: "/user/interactions/:userId?",
        name: "UserInteractions",
        component: () => import("@/views/user/profile/interactions.vue"),
        meta: {
          title: "用户交互",
          showLink: false,
          requiresAuth: true
        }
      },
      {
        path: "/user/messages",
        name: "UserMessages",
        component: () => import("@/views/user/message-center/index.vue"),
        meta: {
          title: "消息中心",
          showLink: false,
          requiresAuth: true
        }
      },
      {
        path: "/user/notification-settings",
        name: "UserNotificationSettings",
        component: () => import("@/views/user/notification-settings/index.vue"),
        meta: {
          title: "通知设置",
          showLink: false,
          requiresAuth: true
        }
      },
      {
        path: "/user/ranking",
        name: "UserRanking",
        component: () => import("@/views/user/ranking/index.vue"),
        meta: {
          title: "榜单",
          showLink: false
        }
      }
      // 注释掉不再使用的路由，已改为使用 /user/article/my
      // {
      //   path: "/user/article/list",
      //   name: "UserArticleList",
      //   component: () => import("@/views/user/article/list.vue"),
      //   meta: {
      //     title: "我的文章",
      //     showLink: false,
      //     requiresAuth: true
      //   }
      // }
    ]
  }
] satisfies Array<RouteConfigsTable>;
